<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>Donxon SDK Docs</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>Donxon SDK</h1>

<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Data_Structures">Data Structures</a></li>
<li><a href="#Tables">Tables</a></li>
<li><a href="#Fields">Fields</a></li>
<li><a href="#Methods">Methods</a></li>
<li><a href="#Event_Callbacks">Event Callbacks </a></li>
<li><a href="#Metamethods">Metamethods</a></li>
</ul>


<h2>Classes</h2>
<ul class="nowrap">
  <li><a href="../classes/Debug.html">Debug</a></li>
  <li><a href="../classes/StringBuffer.html">StringBuffer</a></li>
  <li><a href="../classes/Hook.html">Hook</a></li>
  <li><a href="../classes/System.UTF8.html">System.UTF8</a></li>
  <li><a href="../classes/Common.Color.html">Common.Color</a></li>
  <li><a href="../classes/Common.Vector2D.html">Common.Vector2D</a></li>
  <li><a href="../classes/Common.Vector.html">Common.Vector</a></li>
  <li><strong>Common.NetMessage</strong></li>
  <li><a href="../classes/Common.TextMenu.html">Common.TextMenu</a></li>
  <li><a href="../classes/Common.ScreenFade.html">Common.ScreenFade</a></li>
  <li><a href="../classes/Common.HUDText.html">Common.HUDText</a></li>
  <li><a href="../classes/Game.NetMessage.html">Game.NetMessage</a></li>
  <li><a href="../classes/Game.TextMenu.html">Game.TextMenu</a></li>
  <li><a href="../classes/Game.ScreenFade.html">Game.ScreenFade</a></li>
  <li><a href="../classes/Game.BarTime.html">Game.BarTime</a></li>
  <li><a href="../classes/UI.Rectangle.html">UI.Rectangle</a></li>
  <li><a href="../classes/UI.ProgressBar.html">UI.ProgressBar</a></li>
  <li><a href="../classes/UI.TextMenu.html">UI.TextMenu</a></li>
  <li><a href="../classes/UI.ScreenFade.html">UI.ScreenFade</a></li>
  <li><a href="../classes/UI.BarTime.html">UI.BarTime</a></li>
</ul>
<h2>Globals</h2>
<ul class="nowrap">
  <li><a href="../globals/Properties.html">Properties</a></li>
  <li><a href="../globals/Functions.html">Functions</a></li>
  <li><a href="../globals/Classes.html">Classes</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
  <li><a href="../modules/System.html">System</a></li>
  <li><a href="../modules/Common.html">Common</a></li>
  <li><a href="../modules/Game.html">Game</a></li>
  <li><a href="../modules/UI.html">UI</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
  <li><a href="../topics/changelog.md.html">changelog</a></li>
  <li><a href="../topics/credit.md.html">credit</a></li>
  <li><a href="../topics/license.html">license</a></li>
</ul>
<h2>Examples</h2>
<ul class="nowrap">
  <li><a href="../examples/bartime.game.lua.html">bartime.game.lua</a></li>
  <li><a href="../examples/bartime.ui.lua.html">bartime.ui.lua</a></li>
  <li><a href="../examples/deltatiming.game.lua.html">deltatiming.game.lua</a></li>
  <li><a href="../examples/deltatiming.ui.lua.html">deltatiming.ui.lua</a></li>
  <li><a href="../examples/hook.game.lua.html">hook.game.lua</a></li>
  <li><a href="../examples/netmsg.simple.common.lua.html">netmsg.simple.common.lua</a></li>
  <li><a href="../examples/netmsg.simple.game.lua.html">netmsg.simple.game.lua</a></li>
  <li><a href="../examples/netmsg.simple.ui.lua.html">netmsg.simple.ui.lua</a></li>
  <li><a href="../examples/progressbar.ui.lua.html">progressbar.ui.lua</a></li>
  <li><a href="../examples/rectangle.ui.lua.html">rectangle.ui.lua</a></li>
  <li><a href="../examples/screenfade.game.lua.html">screenfade.game.lua</a></li>
  <li><a href="../examples/screenfade.ui.lua.html">screenfade.ui.lua</a></li>
  <li><a href="../examples/stringbuffer.lua.html">stringbuffer.lua</a></li>
  <li><a href="../examples/textmenu.simple.game.lua.html">textmenu.simple.game.lua</a></li>
  <li><a href="../examples/utf8.lua.html">utf8.lua</a></li>
  <li><a href="../examples/vector.2d.lua.html">vector.2d.lua</a></li>
  <li><a href="../examples/vector.3d.lua.html">vector.3d.lua</a></li>
</ul>

</div>

<div id="content">

<h1>Class <code>Common.NetMessage</code></h1>
<p>Network Message Builder class.</p>
<p> Used to builds network messages
 that will be sent from server
 to client(s).</p>


<h2><a href="#Data_Structures">Data Structures</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#.netMessageArgumentProperty">.netMessageArgumentProperty</a></td>
	<td class="summary">The net message argument properties.</td>
	</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage.MSG">Common.NetMessage.MSG</a></td>
	<td class="summary">Network message destination types.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage.TYPE">Common.NetMessage.TYPE</a></td>
	<td class="summary">Network message types.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage.ARGFORMAT">Common.NetMessage.ARGFORMAT</a></td>
	<td class="summary">Argument formats.</td>
	</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage.name">Common.NetMessage.name</a></td>
	<td class="summary">Name of this network message.</td>
	</tr>
</table>
<h2><a href="#Methods">Methods</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage:Create">Common.NetMessage:Create (name)</a></td>
	<td class="summary">Constructs a network message.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage:IsRegistered">Common.NetMessage:IsRegistered ([name])</a></td>
	<td class="summary">Checks whether the network message is registered.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage:Register">Common.NetMessage:Register ([...])</a></td>
	<td class="summary">Registers the network message into <a href="../classes/Common.NetMessage.html#Common.NetMessage.TYPE">Common.NetMessage.TYPE</a> table.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage:Unregister">Common.NetMessage:Unregister ([name])</a></td>
	<td class="summary">Unregisters the network message from <a href="../classes/Common.NetMessage.html#Common.NetMessage.TYPE">Common.NetMessage.TYPE</a> table.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage:ToString">Common.NetMessage:ToString ()</a></td>
	<td class="summary">Returns the name of this network message.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage:ToFormatType">Common.NetMessage:ToFormatType (FormatType, Value)</a></td>
	<td class="summary">Converts a value into a proper data type value.</td>
	</tr>
</table>
<h2><a href="#Event_Callbacks">Event Callbacks </a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage:OnSent">Common.NetMessage:OnSent (args)</a></td>
	<td class="summary">Called when this network message is sent to client.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage:OnReceived">Common.NetMessage:OnReceived (args)</a></td>
	<td class="summary">Called when this network message is received from server.</td>
	</tr>
</table>
<h2><a href="#Metamethods">Metamethods</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage.__index">Common.NetMessage.__index</a></td>
	<td class="summary">Base class.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#Common.NetMessage.__tostring">Common.NetMessage.__tostring</a></td>
	<td class="summary">Returns the name of this network message.</td>
	</tr>
</table>

<br/>
<br/>


    <h2 class="section-header "><a name="Data_Structures"></a>Data Structures</h2>

    <dl class="function">
    <dt>
    <a name = ".netMessageArgumentProperty"></a>
    <strong>.netMessageArgumentProperty</strong>
    </dt>
    <dd>
    The net message argument properties.


    <ul>
        <li><span class="parameter">value</span>
            <span class="types"><span class="type">anything</span></span>
         The argument value.
        </li>
        <li><span class="parameter">format</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
         The argument format/datatype.
        </li>
    </ul>





</dd>
</dl>
    <h2 class="section-header "><a name="Tables"></a>Tables</h2>

    <dl class="function">
    <dt>
    <a name = "Common.NetMessage.MSG"></a>
    <strong>Common.NetMessage.MSG</strong>
    </dt>
    <dd>
    Network message destination types.


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">BROADCAST</span>
        <strong>Same as ALL</strong> unreliable to all.
        </li>
        <li><span class="parameter">ONE</span>
        reliable to one (msg_entity).
        </li>
        <li><span class="parameter">ALL</span>
        reliable to all.
        </li>
        <li><span class="parameter">INIT</span>
        <strong>Unsupported</strong> write to the init string.
        </li>
        <li><span class="parameter">PVS</span>
        <strong>Unsupported</strong> Ents in PVS of org.
        </li>
        <li><span class="parameter">PAS</span>
        <strong>Unsupported</strong> Ents in PAS of org.
        </li>
        <li><span class="parameter">PVS_R</span>
        <strong>Unsupported</strong> Reliable to PVS.
        </li>
        <li><span class="parameter">PAS_R</span>
        <strong>Unsupported</strong> Reliable to PAS.
        </li>
        <li><span class="parameter">ONE_UNRELIABLE</span>
        <strong>Same as ONE</strong> Send to one client, got don't put in reliable stream, put in unreliable datagram ( could be dropped ).
        </li>
        <li><span class="parameter">SPEC</span>
        <strong>Unsupported</strong> Sends to all spectator proxies.
        </li>
    </ul>



    <h3>See also:</h3>
    <ul>
         <a href="../classes/Game.NetMessage.html#Game.NetMessage:Begin">Game.NetMessage:Begin</a>
    </ul>


</dd>
    <dt>
    <a name = "Common.NetMessage.TYPE"></a>
    <strong>Common.NetMessage.TYPE</strong>
    </dt>
    <dd>
    Network message types.


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">SHOWMENU</span>
        This message displays a "menu" to a player (text on the left side of the screen).
        </li>
        <li><span class="parameter">SCREENFADE</span>
        This message fades the screen.
        </li>
        <li><span class="parameter">BARTIME</span>
        This message draws a HUD progress bar which is filled from 0% to 100% for the time Duration seconds. Once the bar is fully filled it will be removed from the screen automatically.
        </li>
        <li><span class="parameter">BARTIME2</span>
        The message is the same as BarTime, but StartPercent specifies how much of the bar is (already) filled.
        </li>
        <li><span class="parameter">TE_TEXTMESSAGE</span>
        This message draws a HUD text message.
        </li>
    </ul>



    <h3>See also:</h3>
    <ul>
         <li><a href="../classes/Common.NetMessage.html#Common.NetMessage:Register">Common.NetMessage:Register</a></li>
         <li><a href="../classes/Game.NetMessage.html#Game.NetMessage:Begin">Game.NetMessage:Begin</a></li>
    </ul>


</dd>
    <dt>
    <a name = "Common.NetMessage.ARGFORMAT"></a>
    <strong>Common.NetMessage.ARGFORMAT</strong>
    </dt>
    <dd>
    Argument formats.


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">BYTE</span>
        Unsigned char
        </li>
        <li><span class="parameter">CHAR</span>
        Signed char.
        </li>
        <li><span class="parameter">SHORT</span>
        Signed short.
        </li>
        <li><span class="parameter">LONG</span>
        Signed long.
        </li>
        <li><span class="parameter">ANGLE</span>
        Float in signed char form.
        </li>
        <li><span class="parameter">FLOAT</span>
        Float.
        </li>
        <li><span class="parameter">VECTOR</span>
        Vector string.
        </li>
        <li><span class="parameter">STRING</span>
        String.
        </li>
        <li><span class="parameter">NUMBER</span>
        Lua number.
        </li>
    </ul>





</dd>
</dl>
    <h2 class="section-header "><a name="Fields"></a>Fields</h2>

    <dl class="function">
    <dt>
    <a name = "Common.NetMessage.name"></a>
    <strong>Common.NetMessage.name</strong>
    </dt>
    <dd>
    Name of this network message.


    <ul>
        <li><span class="parameter">name</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
    </ul>





</dd>
</dl>
    <h2 class="section-header "><a name="Methods"></a>Methods</h2>

    <dl class="function">
    <dt>
    <a name = "Common.NetMessage:Create"></a>
    <strong>Common.NetMessage:Create (name)</strong>
    </dt>
    <dd>
    Constructs a network message. </p>

<p> <strong>Note:</strong> This will not register the network message.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">name</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
         The name of this network message.
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="../classes/Common.NetMessage.html#">Common.NetMessage</a></span>
        The new network message.
    </ol>


    <h3>See also:</h3>
    <ul>
         <a href="../classes/Common.NetMessage.html#Common.NetMessage:Register">Common.NetMessage:Register</a>
    </ul>

    <h3>Usage:</h3>
    <ul>
        <pre class="example"><span class="keyword">local</span> myMsg = Common.NetMessage:Create( <span class="string">"MyNetMessage"</span> );</pre>
    </ul>

</dd>
    <dt>
    <a name = "Common.NetMessage:IsRegistered"></a>
    <strong>Common.NetMessage:IsRegistered ([name])</strong>
    </dt>
    <dd>
    Checks whether the network message is registered.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">name</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
         The network message name.
         (<em>optional</em>)
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">bool</span></span>
        Returns true if already registered.
    </ol>




</dd>
    <dt>
    <a name = "Common.NetMessage:Register"></a>
    <strong>Common.NetMessage:Register ([...])</strong>
    </dt>
    <dd>
    Registers the network message into <a href="../classes/Common.NetMessage.html#Common.NetMessage.TYPE">Common.NetMessage.TYPE</a> table. </p>

<p> The table index will be formatted as upper-case string.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">...</span>
         Arguments will be passed to constructs a new network message.
         (<em>optional</em>)
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="../classes/Common.NetMessage.html#">Common.NetMessage</a></span>
        This network message.
    </ol>


    <h3>See also:</h3>
    <ul>
         <a href="../classes/Common.NetMessage.html#Common.NetMessage:Create">Common.NetMessage:Create</a>
    </ul>

    <h3>Usage:</h3>
    <ul>
        <pre class="example"><span class="keyword">local</span> myMsg = Common.NetMessage:Register( <span class="string">"MyNetMessage"</span> );
<span class="global">print</span>( Common.NetMessage.TYPE.MYNETMESSAGE:ToString() ); <span class="comment">-- print "MyNetMessage".
</span><span class="global">print</span>( myMsg:ToString() ); <span class="comment">-- also print "MyNetMessage".</span></pre>
    </ul>

</dd>
    <dt>
    <a name = "Common.NetMessage:Unregister"></a>
    <strong>Common.NetMessage:Unregister ([name])</strong>
    </dt>
    <dd>
    Unregisters the network message from <a href="../classes/Common.NetMessage.html#Common.NetMessage.TYPE">Common.NetMessage.TYPE</a> table.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">name</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
         The network message name.
         (<em>optional</em>)
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="../classes/Common.NetMessage.html#">Common.NetMessage</a></span>
        This network message.
    </ol>



    <h3>Usage:</h3>
    <ul>
        <pre class="example"><span class="comment">-- you can do this,
</span>myMsg:Unregister();
<span class="comment">-- or you can do this,
</span>Common.NetMessage:Unregister( <span class="string">"MyNetMessage"</span> );
<span class="comment">-- but not doing both!</span></pre>
    </ul>

</dd>
    <dt>
    <a name = "Common.NetMessage:ToString"></a>
    <strong>Common.NetMessage:ToString ()</strong>
    </dt>
    <dd>
    Returns the name of this network message.



    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        The name of this network message.
    </ol>




</dd>
    <dt>
    <a name = "Common.NetMessage:ToFormatType"></a>
    <strong>Common.NetMessage:ToFormatType (FormatType, Value)</strong>
    </dt>
    <dd>
    Converts a value into a proper data type value.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">FormatType</span>
            <span class="types"><a class="type" href="../classes/Common.NetMessage.html#Common.NetMessage.ARGFORMAT">Common.NetMessage.ARGFORMAT</a></span>
         The format data type.
        </li>
        <li><span class="parameter">Value</span>
            <span class="types"><span class="type">anything</span></span>
         Any value.
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">anything</span> or <span class="type">nil</span></span>
        Returns a proper value. | Returns <code>nil</code> if invalid format type.
    </ol>


    <h3>See also:</h3>
    <ul>
         <a href="../classes/Game.NetMessage.html#Game.NetMessage:WriteAngle">Game.NetMessage:WriteAngle</a>
    </ul>


</dd>
</dl>
    <h2 class="section-header "><a name="Event_Callbacks"></a>Event Callbacks </h2>

    <dl class="function">
    <dt>
    <a name = "Common.NetMessage:OnSent"></a>
    <strong>Common.NetMessage:OnSent (args)</strong>
    </dt>
    <dd>
    Called when this network message is sent to client. </p>

<p> <strong>Note:</strong> This event is called in <a href="../modules/Game.html#">Game</a> module.</p>

<p> <strong>Note:</strong> This event is using <a href="../classes/Hook.html#">Hook</a> management.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">args</span>
            <span class="types"><a class="type" href="../classes/Common.NetMessage.html#.netMessageArgumentProperty">.netMessageArgumentProperty[]</a></span>
         The network message arguments.
        </li>
    </ul>



    <h3>See also:</h3>
    <ul>
         <li><a href="../classes/Game.NetMessage.html#Game.NetMessage:End">Game.NetMessage:End</a></li>
         <li><a href="../classes/Common.NetMessage.html#Common.NetMessage.ARGFORMAT">Common.NetMessage.ARGFORMAT</a></li>
    </ul>

    <h3>Usage:</h3>
    <ul>
        <pre class="example"><span class="keyword">local</span> myMsg = Common.NetMessage:Register( <span class="string">"MyNetMessage"</span> );
<span class="keyword">function</span> myMsg:OnSent (args, format)
  <span class="global">print</span> (self.name .. <span class="string">'is sent!'</span> );
<span class="keyword">end</span></pre>
    </ul>

</dd>
    <dt>
    <a name = "Common.NetMessage:OnReceived"></a>
    <strong>Common.NetMessage:OnReceived (args)</strong>
    </dt>
    <dd>
    Called when this network message is received from server. </p>

<p> <strong>Note:</strong> This event is called in <a href="../modules/UI.html#">UI</a> module.</p>

<p> <strong>Note:</strong> This event is using <a href="../classes/Hook.html#">Hook</a> management.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">args</span>
            <span class="types"><a class="type" href="../classes/Common.NetMessage.html#.netMessageArgumentProperty">.netMessageArgumentProperty[]</a></span>
         The network message arguments.
        </li>
    </ul>



    <h3>See also:</h3>
    <ul>
         <li><a href="../classes/Game.NetMessage.html#Game.NetMessage:End">Game.NetMessage:End</a></li>
         <li><a href="../classes/Common.NetMessage.html#Common.NetMessage.ARGFORMAT">Common.NetMessage.ARGFORMAT</a></li>
    </ul>

    <h3>Usage:</h3>
    <ul>
        <pre class="example"><span class="keyword">local</span> myMsg = Common.NetMessage:Register( <span class="string">"MyNetMessage"</span> );
<span class="keyword">function</span> myMsg:OnReceived (args, format)
  <span class="global">print</span> (self.name .. <span class="string">'is received!'</span> );
<span class="keyword">end</span></pre>
    </ul>

</dd>
</dl>
    <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>

    <dl class="function">
    <dt>
    <a name = "Common.NetMessage.__index"></a>
    <strong>Common.NetMessage.__index</strong>
    </dt>
    <dd>
    Base class.


    <ul>
        <li><span class="parameter">__index</span>
            <span class="types"><a class="type" href="../classes/Common.NetMessage.html#">Common.NetMessage</a></span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "Common.NetMessage.__tostring"></a>
    <strong>Common.NetMessage.__tostring</strong>
    </dt>
    <dd>
    Returns the name of this network message.


    <ul>
        <li><span class="parameter">__tostring</span>
            <span class="types"><a class="type" href="../classes/Common.NetMessage.html#Common.NetMessage:ToString">Common.NetMessage.ToString</a></span>



        </li>
    </ul>





</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-06-15 21:15:36 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>
